package es.juanc.dates;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Fechas 
{
	
	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{		
		//Date d1 = new Date( "30/02/07" );
		//System.out.println( "***** date1: " + d1 );
		
		//Date d2 = new Date( "07/13/24" );		
		//System.out.println( "***** date2: " + d2 );
		
		String formato = "dd/MM/yyyy";
		String fecha = "28/02/2008";
		
		try {
			SimpleDateFormat formatoFecha = new SimpleDateFormat(formato);
			formatoFecha.setLenient(false);
			Date d = formatoFecha.parse(fecha);
			System.out.println( "***** date_parseada: " + d );
			java.sql.Date sql_date = new java.sql.Date( d.getTime() );
			System.out.println( "***** sql_date: " + sql_date );
		} 
		catch (ParseException e) {
			System.out.println( e.getMessage() + " / " + e.toString() );
			e.printStackTrace();
		}
		
		//System.out.println( "***** date2: " + new SimpleDateFormat("ddMMyyyy", new Locale("en") ).format(d2) );
		
		//java.util.Date d1 = new java.util.Date();
		//System.out.println( "***** date1: " + d1.toString() );
		
		//java.sql.Date d2 = new java.sql.Date( new java.util.Date().getTime() );
		//System.out.println( "***** date2: " + d2.toString() );
		
//		System.out.println( "***** date: " + d.getDay() );
//		System.out.println( "***** date: " + (d.getYear()+1900) + "/" + (d.getMonth()+1) + "/" + d.getDate() );		

//		Calendar c1 = Calendar.getInstance( new Locale( "es" ) );
//		Calendar c2 = Calendar.getInstance( new Locale( "en" ) );
//		
//		System.out.println( "***** date: " + c1 );
//		System.out.println( "***** date: " + c2 );
		
//		System.out.println( "***** calendar: " + c.get( Calendar.DAY_OF_MONTH ) );
//		System.out.println( "***** calendar: " + c.get( Calendar.MONTH ) );
//		System.out.println( "***** calendar: " + c.get( Calendar.YEAR ) );
//		System.out.println( "***** calendar: " + c.get( Calendar.DATE ) );
//		
//		Calendar from = Calendar.getInstance();
//		from.setTime( new Date() );
//		System.out.println( "***** calendar: " + from.get( Calendar.YEAR )+from.get( Calendar.MONTH )+from.get( Calendar.DATE ) );
//		System.out.println( "***** calendar: " + from.get( Calendar.YEAR ) );
//		System.out.println( "***** calendar: " + from.get( Calendar.MONTH ) );
//		System.out.println( "***** calendar: " + from.get( Calendar.DATE ) );
	}

}
